翻訳と辞書
Words near each other
・ Active Pass
・ Active pen
・ Active Pensionists
・ Active perception
・ Active Phased Array Radar
・ Active pixel sensor
・ Active placebo
・ Active Platform
・ Active policy management
・ Active Power
・ Active protection system
・ Active queue management
・ Active radar homing
・ Active Raid
・ Active recall
Active record pattern
・ Active Records
・ Active rectification
・ Active redundancy
・ Active Reef
・ Active regular United States Army units with campaign credit for the War of 1812
・ Active Release Technique
・ Active reserve
・ Active reserve (KGB)
・ Active return
・ Active Risk
・ Active risk
・ Active Robots
・ Active rock
・ Active rollover protection


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Active record pattern : ウィキペディア英語版
Active record pattern
In software engineering, the active record pattern is an architectural pattern found in software that stores in-memory object data in relational databases. It was named by Martin Fowler in his 2003 book ''Patterns of Enterprise Application Architecture''. The interface of an object conforming to this pattern would include functions such as Insert, Update, and Delete, plus properties that correspond more or less directly to the columns in the underlying database table.
The active record pattern is an approach to accessing data in a database. A database table or view is wrapped into a class. Thus, an object instance is tied to a single row in the table. After creation of an object, a new row is added to the table upon save. Any object loaded gets its information from the database. When an object is updated the corresponding row in the table is also updated. The wrapper class implements accessor methods or properties for each column in the table or view.
This pattern is commonly used by object persistence tools, and in object-relational mapping (ORM). Typically, foreign key relationships will be exposed as an object instance of the appropriate type via a property.
== Implementations ==
Implementations of the concept can be found in various frameworks for many programming environments. For example, if in a database there is a table parts with columns name (string type) and price (number type), and the Active Record pattern is implemented in the class Part, the pseudo-code
part = new Part()
part.name = "Sample part"
part.price = 123.45
part.save()
will create a new row in the parts table with the given values, and is roughly equivalent to the SQL command

INSERT INTO parts (name, price) VALUES ('Sample part', 123.45);

Conversely, the class can be used to query the database:
b = Part.find_first("name", "gearbox")
This will find a new Part object based on the first matching row from the parts table whose name column has the value "gearbox". The SQL command used might be similar to the following, depending on the SQL implementation details of the database:

SELECT
* FROM parts WHERE name = 'gearbox' LIMIT 1; -- MySQL or PostgreSQL


抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Active record pattern」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.